<%--
  Created by IntelliJ IDEA.
  User: 门铎
  Date: 2016/6/24
  Time: 9:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>智能海洋机器人研究中心</title>
    <!-- BOOTSTRAP STYLES-->
    <link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet" />
    <!-- FONTAWESOME STYLES-->
    <link href="${pageContext.request.contextPath}/css/font-awesome.css" rel="stylesheet" />
    <!--CUSTOM BASIC STYLES-->
    <link href="${pageContext.request.contextPath}/css/basic.css" rel="stylesheet" />
    <!--CUSTOM MAIN STYLES-->
    <link href="${pageContext.request.contextPath}/css/custom.css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
    <jsp:include page="../manage/nav-top.jsp"/>
    <jsp:include page="../manage/nav.jsp"/>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <ol class="breadcrumb">
                        <li><a href="#">首页</a></li>
                        <li><a href="active">个人基本信息</a></li>
                    </ol>
                    <hr />
                    <ul class="nav nav-pills">
                        <li>
                            <a href="${pageContext.request.contextPath}/cimv/user/details/${userId}">
                                <i class="glyphicon glyphicon-user"></i>个人基本信息
                            </a>
                        </li>
                        <li class="active">
                            <a><i class="glyphicon glyphicon-plus"></i>新建详细信息列</a>
                        </li>
                    </ul>
                    <hr />
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                        <div class="form-group">
                            <label for="sid" class="control-label">排序序号:</label>
                            <input type="text" class="form-control"  id="sid" name="sid" >
                            <p class="help-block"></p>
                        </div>
                        <div class="form-group">
                            <label for="itemName" class="control-label">信息列标题:</label>
                            <input type="text" class="form-control" id="itemName" name="itemName" >
                            <p class="help-block"></p>
                        </div>
                        <!-- 加载编辑器的容器 -->
                        <p class="title" style="font-weight:bold;">信息列内容</p>
                        <script id="editor" name="content" type="text/plain">

                        </script>
                        <button class="btn btn-primary " data-toggle="modal"
                                data-target="#myModal">
                            提交
                        </button>

                        <!-- 模态框（Modal） -->
                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                             aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close"
                                                data-dismiss="modal" aria-hidden="true">
                                            &times;
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel">
                                            提示
                                        </h4>
                                    </div>
                                    <div class="modal-body">
                                        确定要增加这条个人信息列么？
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default"
                                                data-dismiss="modal">关闭
                                        </button>
                                        <button  id="insert"  type="button" class="btn btn-primary" data-dismiss="modal">
                                            确定
                                        </button>
                                    </div>
                                </div><!-- /.modal-content -->
                            </div><!-- /.modal -->
                        </div>
                        <div  id="myModal2" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
                        <div class="modal-dialog modal-sm">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="exampleModalLabel">提示</h4>
                                </div>

                                <div class="modal-body">
                                    <div id="myModel2Msg" class="alert alert-success">
                                        发布成功！
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->

<jsp:include page="../manage/footer.jsp" />
<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
<!-- JQUERY SCRIPTS -->
<script src="${pageContext.request.contextPath}/js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
<!-- METISMENU SCRIPTS -->
<script src="${pageContext.request.contextPath}/js/jquery.metisMenu.js"></script>
<!-- CUSTOM SCRIPTS -->
<script src="${pageContext.request.contextPath}/js/custom.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('editor');
</script>
<script>

    $(function(){
        $('#insert').click(function () {
            var  title = $("#title").val();
            var  summer = $("#summer").val();
            $.ajax({
                url: '/cimv/user/memberItemCreate/${userId}',
                type: 'POST',
                dataType: 'json',
                data: {
                    "sid": $('#sid').val(),
                    "userId":${userId},
                    "itemName": $('#itemName').val(),
                    "itemContent":ue.getContent()
                }
            }).done(function(data) {
                $('#myModel2Msg').html(""+data.msg);
                $('#myModal2').modal('show');
                setTimeout(function () {
                    $('#myModal2').modal('hide');
                },1000*2);
            })
                    .fail(function(data) {
                        console.log(data);
                        console.log("error");
                    })
                    .always(function() {
                        console.log("complete");
                    });
        });


    });

</script>

</body>

</html>
